<?php
class ControllerModuleInformation extends Controller
{
	/*function __construct() 
	{
		$this->iscache = true;
	 	$this->name ="Information".$this->document->sitemapid;
   	}*/
	public function index($sitemapid="")
	{
		$this->load->model("core/media");
		
		if($sitemapid=="")
			$sitemapid = $this->document->sitemapid;
		
		
		$this->data['post'] = $this->model_core_media->getItem($this->member->getSiteId().$sitemapid);
		$this->document->title .= " - ".$this->data['post']['title'];
		
		if(count($this->data['post']) == 0)
		{
			$this->data['post']['description'] = "Updating...";
		}
		
		$this->data['post']['description'] = html_entity_decode($this->data['post']['description'.$this->data['lang']]);
		$this->document->meta_description = substr( strip_tags($this->data['post']['summary']),0,155);
		$this->document->meta_keyword = substr( strip_tags($this->data['post']['keyword']),0,155);
		$this->data['child'] = $this->model_core_media->getListByParent($this->member->getSiteId().$sitemapid," AND mediatype = 'subinfor' Order by position");
		$listfileid = $this->model_core_media->getInformation(SITEID.$sitemapid, "attachment");
		if($listfileid != "")
		{
			$arrfileid = split(",",$listfileid);
			$data_listimage = array();
		
			foreach($arrfileid as $key => $fileid)
			{
				$file = $this->model_core_file->getFile($fileid);
				$data_listimage[$key]['imagethumbnail'] = HelperImage::resizePNG($file['filepath'], 60, 60);
				$data_listimage[$key]['imagepreview'] = HelperImage::resizePNG($file['filepath'], 775, 775);
			}
		}
		$this->data['listimages'] = $data_listimage;
		/*if($sitemapid == "product-services")
		{
			$template = array(
							  'template' => "common/gallery_colorbox.tpl",
							  'width' => 0,
							  'height' =>210
							  );
			
			$arr = array("gallery",0,"",$template);
			$this->data['post']['description'].= $this->loadModule('module/block','getList',$arr);
		}*/
		$this->id="information";
		$this->template="module/information.tpl";
		$this->render();
	}
}
?>